home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-10 | 3.3 KB | 123 lines | [TEXT/PJMM] |
- unit DemoList_Procs;
-
- interface
-
- uses
- vListMngr, vListDemo_Globals, DemoList_Window;
-
- procedure NewDemoList;
- procedure CloseDemoList;
- procedure ShowHeadings;
- procedure ClearHeadings;
- procedure RefreshList;
-
-
- implementation
-
- const
- cellHeight = 0; {# pixels per cell}
- nCols = 12; {# cells to start with}
- nhRows = 2;
-
-
- procedure RefreshList;
- {restore original cell widths and values}
- var
- i, j: INTEGER;
- tStr: STR255;
- theCell: Cell;
- tWidths: widthArray;
- begin
- if DemoList <> nil then
- begin
- vLActivate(FALSE, DemoList); {don't draw till all cells are set}
- for i := 0 to nCols - 1 do
- for j := 0 to nCols - 1 do
- begin
- tStr := Concat(StringOf(i : 2), ',', StringOf(j : 2));
- theCell.h := i;
- theCell.v := j;
- vLSetCell(Ptr(ORD4(@tStr) + 1), Length(tStr), theCell, DemoList);
- end;
- for i := 0 to maxCols do
- tWidths[i] := DemoList^^.cellSize.h;
- vLActivate(TRUE, DemoList); {redraw list now}
- vLSetWidths(tWidths, DemoList);
- end; {DemoList <> nil}
- end; { procedure RefreshList}
-
- procedure NewDemoList;
- var
- lView, dBounds: RECT;
- tWidths: widthArray;
- i, j, k, tableWidth: INTEGER;
- theCell, cellSize: Point;
- tStr: STR255;
- tRect, teRect: RECT;
- MyPeek: WindowPeek;
-
- begin
- Open_DemoList_Window;
- MyPeek := WindowPeek(DemoListWindow);
- { DemoListWindow := FrontWindow; {}
- { SetWTitle(DemoListWindow, 'Untitled'); {}
- SetRect(lView, 5, 5, DemoListWindow^.portRect.right - 31, DemoListWindow^.portRect.bottom - 31); {}
- SetRect(dBounds, 0, 0, nCols, nCols); {nCols cols to start}
- SetPt(cellSize, 0, 0);
- DemoList := vLNew(lView, dBounds, cellSize, 0, DemoListWindow, FALSE, TRUE, TRUE, TRUE); {v 9}
- { DemoList := vLNew(lView, dBounds, cellSize, 0, DemoListWindow, FALSE, TRUE, FALSE, FALSE); {No Scroll bars}
- TheListScrap := vLNewScrap;
- RefreshList;
- SetPt(theCell, 0, 0);
- vLIndent(theCell, DemoList);
- SetPt(theCell, 0, 0);
- DemoList^^.lastClick := theCell; {emulate click in theCell}
- vLTENew(FALSE, theCell, DemoList); {set up a TE record for list}
- vLActivateTE(FALSE, DemoList); {start with TE inactive}
- activeTE := DemoList^^.listTE; {so we can flash cursor}
- vLActivate(TRUE, DemoList); {show the list}
- end; { procedure NewDemoList}
-
-
- procedure ShowHeadings;
- const
- TTHead1 = 'Time | Feed | Collect | Electro | 2Power | 5Valves |'; {}
- TTHead2 = ' min | uL/min | uL/min | on/off | Volts | mAmps | A | B | C | D | E | Notes |'; {}
- nhRow = 2;
- var
- lHeadings: lHeadArray;
- tWidths: widthArray;
- nCols: INTEGER;
- begin
- lHeadings[1] := TTHead1;
- lHeadings[2] := TTHead2;
- vLSetHeadings(nhRow, lHeadings, DemoList);
- vLCalcCellWidths(tWidths, nCols, DemoList); {}
- vLSetWidths(tWidths, DemoList); {}
- activeTE := DemoList^^.listTE; {so we can flash cursor}
- end; {procedure ShowHeadings}
-
- procedure ClearHeadings;
- var
- lHeadings: lHeadArray;
- begin
- vLSetHeadings(0, lHeadings, DemoList);
- RefreshList;
- end; {procedure ClearHeadings}
-
- procedure CloseDemoList;
- begin
- if DemoList <> nil then
- begin
- vLDispose(DemoList);
- DemoList := nil;
- if TheListScrap <> nil then
- begin
- DisposHandle(Handle(TheListScrap));
- TheListScrap := nil;
- end;
- end; {if..}
- end; {}
-
-
- end. {unit DemoList}